home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1993 July / InfoMagic USENET CD-ROM July 1993.ISO / sources / sun / volume2 / calentool / patch5b < prev    next >
Encoding:
Internet Message Format  |  1990-02-04  |  58.9 KB

  1. Subject:  v02i004:  calentool - patch level 5, Part 2/4
  2. Newsgroups: comp.sources.sun
  3. Approved: mcgrew@aramis.rutgers.edu
  4.  
  5. Submitted-by: Bill Randle <billr@saab.cna.tek.com>
  6. Posting-number: Volume 2, Issue 4
  7. Archive-name: calentool/patch5b
  8.  
  9. #! /bin/sh
  10. # This is a shell archive.  Remove anything before this line, then unpack
  11. # it by saving it into a file and typing "sh file".  To overwrite existing
  12. # files, type "sh file -c".  You can also feed this as standard input via
  13. # unshar, or by typing "sh <file", e.g..  If this archive is complete, you
  14. # will see the following message at the end:
  15. #        "End of archive 2 (of 4)."
  16. # Contents:  calencheck.c patches05b
  17. # Wrapped by billr@saab on Mon Dec 18 17:22:42 1989
  18. PATH=/bin:/usr/bin:/usr/ucb ; export PATH
  19. if test -f 'calencheck.c' -a "${1}" != "-c" ; then 
  20.   echo shar: Will not clobber existing file \"'calencheck.c'\"
  21. else
  22. echo shar: Extracting \"'calencheck.c'\" \(9305 characters\)
  23. sed "s/^X//" >'calencheck.c' <<'END_OF_FILE'
  24. X/*
  25. X * $Header: calencheck.c,v 2.1 89/12/15 17:04:41 billr Exp $
  26. X *
  27. X * calencheck.c - check for pending appts without the overhead
  28. X *          of the full blown calentool
  29. X *
  30. X * Copyright (C) 1989 Tektronix, Inc.
  31. X *    All Rights Reserved
  32. X * Permission is hereby granted to use and modify this file in source
  33. X * or binary form as long as it is not sold for profit and this copyright
  34. X * notice remains intact.
  35. X */
  36. X
  37. X#include <stdio.h>
  38. X#include <sys/time.h>
  39. X#include <sys/file.h>
  40. X#include <sys/types.h>
  41. X#include <sys/stat.h>
  42. X#include <sunwindow/defaults.h>
  43. X#include "ct.h"
  44. X
  45. Xint read_only = 1;        /* no modifications allowed */
  46. Xint n_tslots, otherfile = 0;
  47. Xint day_is_open;
  48. Xint include_old = 0, save_old = 0;
  49. Xstruct tm current, today;
  50. Xstruct tm First, Last;
  51. Xchar *progname, *othername;
  52. Xstruct dayslot slots[N_SLOTS];
  53. Xint show_future = 1;
  54. Xint one_based = 0, version2 = 0;
  55. Xchar apts_pathname[160], tmpapts_pathname[2];
  56. Xchar apts_dir[128], lib_dir[128];
  57. Xchar *strcpy(), *strcat(), *rindex(), *getenv();
  58. X
  59. Xmain(argc,argv)
  60. Xint argc;
  61. Xchar *argv[];
  62. X{
  63. X    int flag;
  64. X    extern char *optarg;
  65. X    
  66. X    if (progname = rindex(*argv, '/'))
  67. X        progname++;
  68. X    else
  69. X        progname = *argv;
  70. X
  71. X    n_tslots = (N_TSLOTS > N_SLOTS ? N_SLOTS : N_TSLOTS);
  72. X
  73. X    get_today();    /* initial day is today */
  74. X    current = today;
  75. X    
  76. X    while ((flag = getopt(argc, argv, "f:")) != EOF)
  77. X        switch (flag) {
  78. X            case 'f':   /* use this file */
  79. X            otherfile = 1;
  80. X            othername = optarg;
  81. X            break;
  82. X
  83. X            case '?':
  84. X            default:
  85. X            fprintf(stderr, "usage: %s [-f <appt_file>]\n", progname);
  86. X            exit(1);
  87. X        }
  88. X
  89. X    err2console(TRUE);
  90. X    do_files();
  91. X    check_calendar();
  92. X    for (;;) {
  93. X        /* only check appointments every TIME_OUT minutes */
  94. X        sleep(TIME_OUT);
  95. X        check_calendar();
  96. X    }
  97. X}
  98. X
  99. X/*
  100. X * When timer has expired check to see if we are close to an
  101. X * appointment. If so, print message on the console.
  102. X */
  103. Xcheck_calendar()
  104. X{
  105. X    int appt_pending = 0;     /* no appointments pending */
  106. X    int some_appts = 0;    /* no appointments today */
  107. X    int slotno = 0;     /* start with first timeslot */
  108. X    static int echoed_sno = -1;
  109. X    static int new_day = 0;
  110. X    static time_t lastmod = (time_t)0;
  111. X    struct stat stbuf;
  112. X    int sno;
  113. X    FILE *console;
  114. X
  115. X    sno = echoed_sno;    /* assume no console echo */
  116. X    get_today();
  117. X    stat(apts_pathname, &stbuf);
  118. X    /*
  119. X     * Check to see if we've run over into the next day or if
  120. X     * the appts file has been modified recently. If so,
  121. X     * we need to update our slot information.
  122. X     */
  123. X    if (ymd_compare(current, today) != 0) {
  124. X        current = today;
  125. X        lastmod = stbuf.st_mtime;
  126. X        (void)get_day_appts();
  127. X        if (!new_day) {
  128. X            new_day++;
  129. X            sno = echoed_sno = -1;
  130. X        }
  131. X    } else if (stbuf.st_mtime > lastmod) {
  132. X        lastmod = stbuf.st_mtime;
  133. X        (void)get_day_appts();
  134. X        sno = echoed_sno = -1;
  135. X        new_day = 0;
  136. X    } else
  137. X        new_day = 0;
  138. X    if (today.tm_hour >= START_HOUR) {
  139. X        slotno = (today.tm_hour - START_HOUR)*2 + today.tm_min/30;
  140. X        if (slotno < n_tslots) {
  141. X            if (slots[slotno].active != INACTIVE) {
  142. X                /* appointment is happening now */
  143. X                appt_pending++;
  144. X                if (slots[slotno].active == ACTIVE)
  145. X                    sno = slotno;
  146. X            } else if (slotno+1 < n_tslots) {
  147. X                if (slots[slotno+1].active != INACTIVE)
  148. X                    /* are we within 10 mins of an appointment? */
  149. X                    if ((today.tm_min % 30) >= 20) {
  150. X                        appt_pending++;
  151. X                        if (slots[slotno+1].active == ACTIVE)
  152. X                            sno = slotno+1;
  153. X                    }
  154. X            }
  155. X        }
  156. X    }
  157. X    if (!appt_pending) {
  158. X        /*
  159. X         * Is there anything happening today (optionally
  160. X         * including memos)?
  161. X         * Don't care about things that happened before now
  162. X         * so start looking at <slotno>, which was set above to
  163. X         * reflect the current hour (or 0 if before START_HOUR).
  164. X         */
  165. X        /*
  166. X         * APPT_CHECK_LIMIT is typically either "n_tslots"
  167. X         * or "N_SLOTS" depending on whether we include the
  168. X         * notes section when indicating that we still have
  169. X         * appts today.
  170. X         */
  171. X        while (slotno < APPT_CHECK_LIMIT)
  172. X            if (slots[slotno++].active != INACTIVE) {
  173. X                some_appts++;
  174. X                break;
  175. X            }
  176. X    } else {
  177. X         /* notify the user via the console (once) ... */
  178. X        if (sno != echoed_sno) {
  179. X            echoed_sno = sno;
  180. X            if (getenv("WINDOW_PARENT") != NULL && (console = fopen("/dev/console", "w")) != NULL) {
  181. X                fprintf(console, "<< %s >> %s\n", progname, slots[sno].cur_appt->str);
  182. X                fclose(console);
  183. X            } else {
  184. X                fprintf(stderr, "\007\007<< %s >> %s\n", progname, slots[sno].cur_appt->str);
  185. X            }
  186. X        }
  187. X    }
  188. X    if (new_day) {
  189. X        new_day = 0;
  190. X    }
  191. X}
  192. X
  193. X/* stripped down version of do_files() from init.c */
  194. Xdo_files()
  195. X{
  196. X    char *slash, *default_ptr, *envptr;
  197. X    char buff[80];
  198. X    int to_slash, getpid(), fd, errflag, numask;
  199. X    struct passwd *pw;
  200. X    struct stat statbuf;
  201. X    FILE *appts;
  202. X
  203. X    if (otherfile) {
  204. X        strcpy(apts_pathname, othername);
  205. X        if ((slash = rindex(apts_pathname, '/')) != NULL) {
  206. X            to_slash = slash - apts_pathname;
  207. X            strncpy(apts_dir, apts_pathname, to_slash);
  208. X            apts_dir[to_slash] = '\0';
  209. X        } else {
  210. X            strcpy(apts_dir, ".");
  211. X        }
  212. X    } else {
  213. X        if ((default_ptr = defaults_get_string("/CalenTool/Appts", NULL, 0)) != NULL) {
  214. X            if ((slash = rindex(default_ptr, '/')) != NULL) {
  215. X                to_slash = slash - default_ptr;
  216. X                strncpy(apts_dir, default_ptr, to_slash);
  217. X                apts_dir[to_slash] = '\0';
  218. X            } else {
  219. X                strcpy(apts_dir, ".");
  220. X            }
  221. X        } else if ((envptr = getenv("CALENTOOL_DIR")) != NULL) {   
  222. X            strcpy(apts_dir, envptr);
  223. X        } else if ((envptr = getenv("HOME")) != NULL) {   
  224. X            strcpy(apts_dir, envptr);
  225. X        } else {   
  226. X            apts_dir[0] = '\0';
  227. X        }
  228. X        if (*apts_dir) {
  229. X            /* prepend directory on pathnames */
  230. X            sprintf(apts_pathname, "%s/.appointments", apts_dir);
  231. X        } else {
  232. X            /* use current directory */
  233. X            strcpy(apts_pathname, ".appointments");
  234. X        }
  235. X    }
  236. X    
  237. X    /* directory for date/event data files */
  238. X    if ((default_ptr = defaults_get_string("/CalenTool/LibDir", NULL, 0)) != NULL)
  239. X        strcpy(lib_dir, default_ptr);
  240. X    else
  241. X        strcpy(lib_dir, DATELIB_DIR);
  242. X
  243. X    errflag = 0;
  244. X    if (access(apts_pathname, R_OK) == -1) {
  245. X        fprintf(stderr, "Cannot access calendar file %s - create? ", apts_pathname);
  246. X        fgets(buff, 80, stdin);
  247. X        if (buff[0] == 'y' || buff[0] == 'Y') {
  248. X            if ((fd=open(apts_pathname, O_CREAT|O_RDWR, 0644)) <= 0) {
  249. X                perror(apts_pathname);
  250. X                return(1);
  251. X            } else {
  252. X                if (write(fd, HEADER, sizeof(HEADER)) != sizeof(HEADER)) {
  253. X                    perror("writing header");
  254. X                    close(fd);
  255. X                    return(1);
  256. X                }
  257. X                close(fd);
  258. X                one_based = 1;
  259. X            }
  260. X        } else
  261. X            return(1);
  262. X    }
  263. X
  264. X    /* check first line of appts file to see if it is the new style */
  265. X    if ((appts = fopen(apts_pathname, "r")) != NULL) {
  266. X        fgets(buff, 80, appts);
  267. X        fclose(appts);
  268. X        if (!strcmp(buff, HEADER)) {
  269. X            version2 = 1;
  270. X            one_based = 1;
  271. X        } else
  272. X            err_rpt("wrong version appointments file format", FATAL);
  273. X    }
  274. X    return;
  275. X}
  276. X
  277. X/* stubs for needed routines where we don't want the whole
  278. X * thing.
  279. X */
  280. Xdeactivate_slot(bi, dpyflag)
  281. Xint bi;
  282. Xint dpyflag;
  283. X{
  284. X    slots[bi].active = INACTIVE;
  285. X}
  286. X
  287. X/* returns pointer to slot containing arrow head */
  288. Xint
  289. Xdeactivate_lower_arrows(bi, dpyflag)
  290. Xint bi, dpyflag;
  291. X{
  292. X    while (bi < N_SLOTS-1) {
  293. X        bi++;
  294. X        if (slots[bi].active != ARROW_SHAFT &&
  295. X            slots[bi].active != ARROW_HEAD)
  296. X            return(bi-1);
  297. X        slots[bi].active = INACTIVE;
  298. X    }
  299. X}
  300. X
  301. Xdraw_day_appts()
  302. X{
  303. X}
  304. X
  305. X/* activate a hidden appt and make it visible */
  306. Xint
  307. Xactivate_slot(bi, dpyflag)
  308. Xint bi;
  309. Xint dpyflag;
  310. X{
  311. X    int n, e_slot;
  312. X
  313. X    if (slots[bi].count <= 0)
  314. X        /* nothing to activate */
  315. X        return(0);
  316. X    if (slots[bi].cur_appt == NULL) {
  317. X        /* may be hidden arrows */
  318. X        /* find appt that they came from so we can see if
  319. X         * it should be arrow shaft or arrow head
  320. X         */
  321. X        n = bi;
  322. X        while (--n >= 0 && slots[n].active != ACTIVE)
  323. X            ;
  324. X        if (n >= 0) {
  325. X            e_slot = n + slots[n].cur_appt->arrows;
  326. X            if (e_slot < bi)
  327. X                /* no arrows here to show */
  328. X                return(0);
  329. X            while (++n < e_slot && slots[n].active != ACTIVE)
  330. X                slots[n].active = ARROW_SHAFT;
  331. X            if (slots[n].active != ACTIVE)
  332. X                slots[n].active = ARROW_HEAD;
  333. X        } else
  334. X            /* no active appt above */
  335. X            return(0);
  336. X    } else {
  337. X        /* there's a real appt hidden */
  338. X        slots[bi].active = ACTIVE;
  339. X        if (slots[bi].cur_appt->arrows > 0) {
  340. X            e_slot = bi + slots[bi].cur_appt->arrows;
  341. X            while (++bi < e_slot && slots[bi].active != ACTIVE)
  342. X                slots[bi].active = ARROW_SHAFT;
  343. X            if (slots[bi].active != ACTIVE)
  344. X                slots[bi].active = ARROW_HEAD;
  345. X        }
  346. X    }
  347. X    if (dpyflag)
  348. X        draw_day_appts();    /* redraw display */
  349. X    return(1);
  350. X}
  351. X
  352. Xnext_appt(bi, dpyflag)
  353. Xint bi;
  354. Xint dpyflag;
  355. X{
  356. X    if (slots[bi].active == ACTIVE) {
  357. X        deactivate_slot(bi, dpyflag);
  358. X        if (slots[bi].cur_appt->arrows > 0)
  359. X            (void)deactivate_lower_arrows(bi, dpyflag);
  360. X    } else
  361. X        /* must have arrows displayed */
  362. X        (void)deactivate_lower_arrows(bi, dpyflag);
  363. X
  364. X    if (slots[bi].cur_appt == NULL)
  365. X        /* end of the chain */
  366. X        slots[bi].cur_appt = slots[bi].first;
  367. X    else
  368. X        /* activate next in chain */
  369. X        slots[bi].cur_appt = slots[bi].cur_appt->next;
  370. X    /* make sure it is not a deleted one */
  371. X    if (chk_deleted(bi))
  372. X        next_appt(bi, dpyflag); /* try next in chain */
  373. X    else if (!activate_slot(bi, dpyflag))
  374. X        next_appt(bi, dpyflag); /* try next in chain */
  375. X}
  376. X
  377. X/* check to see if current is deleted */
  378. Xint
  379. Xchk_deleted(bi)
  380. Xint bi;
  381. X{
  382. X    int found = 0;
  383. X    struct appt_entry *aptr;
  384. X
  385. X    if (slots[bi].cur_appt == NULL)
  386. X        return(0);
  387. X    if (slots[bi].cur_appt->flags & DELETED)
  388. X        return(1);
  389. X    /* run through the list to see if there are any deleted */
  390. X    for (aptr=slots[bi].first; aptr; aptr=aptr->next)
  391. X        if (aptr->flags & DELETED) {
  392. X            /* now see if the current one matches */
  393. X            if (!strcmp(aptr->str, slots[bi].cur_appt->str))
  394. X                return(1);
  395. X        }
  396. X    
  397. X    return(0);
  398. X}
  399. END_OF_FILE
  400. if test 9305 -ne `wc -c <'calencheck.c'`; then
  401.     echo shar: \"'calencheck.c'\" unpacked with wrong size!
  402. fi
  403. # end of 'calencheck.c'
  404. fi
  405. if test -f 'patches05b' -a "${1}" != "-c" ; then 
  406.   echo shar: Will not clobber existing file \"'patches05b'\"
  407. else
  408. echo shar: Extracting \"'patches05b'\" \(46931 characters\)
  409. sed "s/^X//" >'patches05b' <<'END_OF_FILE'
  410. X*** /tmp/,RCSt1a16916    Fri Dec 15 17:22:32 1989
  411. X--- ct.h    Fri Dec 15 17:17:07 1989
  412. X***************
  413. X*** 1,5
  414. X  /*
  415. X!  * $Header: ct.h,v 2.2 89/07/19 20:26:27 billr Exp $
  416. X   */
  417. X  /*
  418. X   * ct.h - header file for calentool
  419. X
  420. X--- 1,5 -----
  421. X  /*
  422. X!  * $Header: ct.h,v 2.3 89/12/15 17:17:04 billr Exp $
  423. X   */
  424. X  /*
  425. X   * ct.h - header file for calentool
  426. X***************
  427. X*** 22,27
  428. X   * notice remains intact.
  429. X   */
  430. X  
  431. X  /* directory for date/event files */
  432. X  #ifndef DATELIB_DIR
  433. X  #    define DATELIB_DIR    "/usr/net/lib/calentool"
  434. X
  435. X--- 22,35 -----
  436. X   * notice remains intact.
  437. X   */
  438. X  
  439. X+ /* ignore several things for calencheck program */
  440. X+ #ifdef CALENCHECK
  441. X+ #    define NO_PRINTER
  442. X+ #    define NO_HOLIDAYS
  443. X+ #    define NO_SUN_MOON
  444. X+ #    define NOTOOL
  445. X+ #endif
  446. X+ 
  447. X  /* directory for date/event files */
  448. X  #ifndef DATELIB_DIR
  449. X  #    define DATELIB_DIR    "/usr/net/lib/calentool"
  450. X***************
  451. X*** 27,33
  452. X  #    define DATELIB_DIR    "/usr/net/lib/calentool"
  453. X  #endif
  454. X  
  455. X! #ifndef NOPRINTER
  456. X  /* command string for sending a file to the Postscript printer */
  457. X  #    ifndef PRINT_CMD
  458. X  #        define PRINT_CMD    "lpr -Plw"
  459. X
  460. X--- 35,41 -----
  461. X  #    define DATELIB_DIR    "/usr/net/lib/calentool"
  462. X  #endif
  463. X  
  464. X! #ifndef NO_PRINTER
  465. X  /* command string for sending a file to the Postscript printer */
  466. X  #    ifndef PRINT_CMD
  467. X  #        define PRINT_CMD    "lpr -Plw"
  468. X***************
  469. X*** 39,44
  470. X  #endif
  471. X  #endif
  472. X  
  473. X  /* define NR_WEEKDAYS for desired week display */
  474. X  /* NR_WEEKDAYS        display   */
  475. X  /*    5        Mon-Fri   */
  476. X
  477. X--- 47,57 -----
  478. X  #endif
  479. X  #endif
  480. X  
  481. X+ #ifndef MAILPROG
  482. X+ #    define MAILPROG        "/usr/ucb/mail"
  483. X+                 /* assumes -s option is available */
  484. X+ #endif
  485. X+ 
  486. X  /* define NR_WEEKDAYS for desired week display */
  487. X  /* NR_WEEKDAYS        display   */
  488. X  /*    5        Mon-Fri   */
  489. X***************
  490. X*** 43,49
  491. X  /* NR_WEEKDAYS        display   */
  492. X  /*    5        Mon-Fri   */
  493. X  /*    6        Mon-Sat      */
  494. X! /*    7        Sun-Sat      */
  495. X  /**/
  496. X  #ifndef NR_WEEKDAYS
  497. X  #    define NR_WEEKDAYS    5
  498. X
  499. X--- 56,62 -----
  500. X  /* NR_WEEKDAYS        display   */
  501. X  /*    5        Mon-Fri   */
  502. X  /*    6        Mon-Sat      */
  503. X! /*    7        Sun-Sat    or Mon-Sun  */
  504. X  /**/
  505. X  #ifndef NR_WEEKDAYS
  506. X  #    define NR_WEEKDAYS    5
  507. X***************
  508. X*** 48,53
  509. X  #ifndef NR_WEEKDAYS
  510. X  #    define NR_WEEKDAYS    5
  511. X  #endif
  512. X  
  513. X  #ifndef START_HOUR
  514. X  #    define START_HOUR    8    /* 8am */
  515. X
  516. X--- 61,69 -----
  517. X  #ifndef NR_WEEKDAYS
  518. X  #    define NR_WEEKDAYS    5
  519. X  #endif
  520. X+ #ifndef MON_FIRST
  521. X+ #    define MON_FIRST    0    /* 0=Sun-Sat, 1=Mon-Sun */
  522. X+ #endif
  523. X  
  524. X  #ifndef START_HOUR
  525. X  #    define START_HOUR    8    /* 8am */
  526. X***************
  527. X*** 55,60
  528. X  #ifndef END_HOUR
  529. X  #    define END_HOUR        18    /* 6pm */
  530. X  #endif
  531. X  
  532. X  #ifndef START_YEAR
  533. X  #    define START_YEAR    89
  534. X
  535. X--- 71,82 -----
  536. X  #ifndef END_HOUR
  537. X  #    define END_HOUR        18    /* 6pm */
  538. X  #endif
  539. X+ #ifndef HOUR_24
  540. X+ #    define HOUR_24        0    /* 0=12hr time, 1=24hr time */
  541. X+ #endif
  542. X+ #ifndef DAY_FIRST
  543. X+ #    define DAY_FIRST    0    /* 0=M/D/Y, 1=D/M/Y */
  544. X+ #endif
  545. X  
  546. X  #ifndef START_YEAR
  547. X  #    define START_YEAR    89
  548. X***************
  549. X*** 66,72
  550. X  #ifndef UPDATE_RATE
  551. X  #    define UPDATE_RATE    "second"    /* update time */
  552. X  #endif                     /* options are "second" & "minute" */
  553. X! #define TIME_OUT    5        /* check appts every 5 minutes */
  554. X  
  555. X  /*
  556. X   * If calentool is too big and you want a stripped-down version
  557. X
  558. X--- 88,94 -----
  559. X  #ifndef UPDATE_RATE
  560. X  #    define UPDATE_RATE    "second"    /* update time */
  561. X  #endif                     /* options are "second" & "minute" */
  562. X! #define TIME_OUT    2        /* check appts every 5 minutes */
  563. X  
  564. X  /*
  565. X   * APPT_CHECK_LIMIT is typically either "n_tslots"
  566. X***************
  567. X*** 69,74
  568. X  #define TIME_OUT    5        /* check appts every 5 minutes */
  569. X  
  570. X  /*
  571. X   * If calentool is too big and you want a stripped-down version
  572. X   * define some or all of these here or in the Makefile. Combined,
  573. X   * they save ~100K bytes.
  574. X
  575. X--- 91,106 -----
  576. X  #define TIME_OUT    2        /* check appts every 5 minutes */
  577. X  
  578. X  /*
  579. X+  * APPT_CHECK_LIMIT is typically either "n_tslots"
  580. X+  * or "N_SLOTS" depending on whether we include the
  581. X+  * notes section when indicating that we still have
  582. X+  * appts today.
  583. X+  */
  584. X+ #ifndef APPT_CHECK_LIMIT
  585. X+ #    define APPT_CHECK_LIMIT    n_tslots
  586. X+ #endif
  587. X+ 
  588. X+ /*
  589. X   * If calentool is too big and you want a stripped-down version
  590. X   * define some or all of these here or in the Makefile. Combined,
  591. X   * they save ~100K bytes.
  592. X***************
  593. X*** 94,109
  594. X  #define N_SLOTS        (N_TSLOTS+10)    /* Total number of slots on a day page. */
  595. X  #define MAX_FUTURE_ENTRIES    32    /* number of appts displayed in popup window */
  596. X  
  597. X- /*
  598. X-  * APPT_CHECK_LIMIT is typically either "n_tslots"
  599. X-  * or "N_SLOTS" depending on whether we include the
  600. X-  * notes section when indicating that we still have
  601. X-  * appts today.
  602. X-  */
  603. X- #ifndef APPT_CHECK_LIMIT
  604. X- #    define APPT_CHECK_LIMIT    n_tslots
  605. X- #endif
  606. X- 
  607. X  /* Dimensions of 30-minute week slot.
  608. X   * Message size determines width - everything else keyed
  609. X   * off font size and message size
  610. X
  611. X--- 126,131 -----
  612. X  #define N_SLOTS        (N_TSLOTS+10)    /* Total number of slots on a day page. */
  613. X  #define MAX_FUTURE_ENTRIES    32    /* number of appts displayed in popup window */
  614. X  
  615. X  /* Dimensions of 30-minute week slot.
  616. X   * Message size determines width - everything else keyed
  617. X   * off font size and message size
  618. X***************
  619. X*** 110,115
  620. X   */
  621. X  #define WEEK_MESSAGE_SIZE    12
  622. X  
  623. X  #define DISPLAYING_DAY          1       /* Defs for state of main */
  624. X  #define DISPLAYING_WEEK         2    /* subwindow (mainsw_state) */
  625. X  #define DISPLAYING_MONTH        3
  626. X
  627. X--- 132,139 -----
  628. X   */
  629. X  #define WEEK_MESSAGE_SIZE    12
  630. X  
  631. X+ #define MAX_INCLUDE_NESTING    4    /* number of allowed include files */
  632. X+ 
  633. X  #define DISPLAYING_DAY          1       /* Defs for state of main */
  634. X  #define DISPLAYING_WEEK         2    /* subwindow (mainsw_state) */
  635. X  #define DISPLAYING_MONTH        3
  636. X***************
  637. X*** 185,190
  638. X  #define MARKED        0x800    /* don't show in month/year display */
  639. X  #define MARKED_NOTE    0xc00
  640. X  #define DELETED        0x1000    /* don't show the appt that matches this */
  641. X  
  642. X  /* format of repeat field for every_someday type appts */
  643. X  #define WEEK1        0x1
  644. X
  645. X--- 209,215 -----
  646. X  #define MARKED        0x800    /* don't show in month/year display */
  647. X  #define MARKED_NOTE    0xc00
  648. X  #define DELETED        0x1000    /* don't show the appt that matches this */
  649. X+ #define RUN        0x2000
  650. X  
  651. X  /* format of repeat field for every_someday type appts */
  652. X  #define WEEK1        0x1
  653. X***************
  654. X*** 216,221
  655. X  #define DST_STDOUT        1
  656. X  #define DST_MAIL        2
  657. X  
  658. X  /* header line in appts file implies one-based entries and 99 memo flag */
  659. X  #define HEADER        "# CalenTool V2 - DO NOT REMOVE THIS LINE\n"
  660. X  
  661. X
  662. X--- 241,253 -----
  663. X  #define DST_STDOUT        1
  664. X  #define DST_MAIL        2
  665. X  
  666. X+ /* return codes from get_day_appts() */
  667. X+ #define NO_ENTRIES    0
  668. X+ #define SOME_APPTS    1
  669. X+ #define SOME_NOTES    2
  670. X+ #define SOME_MKNOTES    4
  671. X+ #define SOME_FUTURES    8
  672. X+ 
  673. X  /* header line in appts file implies one-based entries and 99 memo flag */
  674. X  #define HEADER        "# CalenTool V2 - DO NOT REMOVE THIS LINE\n"
  675. X  
  676. X***************
  677. X*** 224,229
  678. X      /* describes an entry in the appointments file */
  679. X      int year, month, day, hour, minute, arrows;
  680. X      int repeat, lookahead, flags, sindex;
  681. X      char str[MAX_STRLEN];
  682. X      struct appt_entry *next;    /* ptr to next appt in list */
  683. X  };                    /* NULL if last entry */
  684. X
  685. X--- 256,262 -----
  686. X      /* describes an entry in the appointments file */
  687. X      int year, month, day, hour, minute, arrows;
  688. X      int repeat, lookahead, flags, sindex;
  689. X+     int runlength;
  690. X      char str[MAX_STRLEN];
  691. X      struct appt_entry *next;    /* ptr to next appt in list */
  692. X  };                    /* NULL if last entry */
  693. X*** /tmp/,RCSt1a16921    Fri Dec 15 17:22:36 1989
  694. X--- datelib.c    Fri Dec 15 17:17:17 1989
  695. X***************
  696. X*** 1,5
  697. X  /*
  698. X!  * $Header: datelib.c,v 2.2 89/07/19 20:34:23 billr Exp $
  699. X   *
  700. X   * datelib.c - Calendar (date) computation library
  701. X   *
  702. X
  703. X--- 1,5 -----
  704. X  /*
  705. X!  * $Header: datelib.c,v 2.3 89/12/15 17:17:08 billr Exp $
  706. X   *
  707. X   * datelib.c - Calendar (date) computation library
  708. X   *
  709. X***************
  710. X*** 89,94
  711. X          "Sunday", "Monday", "Tuesday", "Wednesday",
  712. X          "Thursday", "Friday", "Saturday"    };
  713. X  static char    timebuf[16];
  714. X  
  715. X  /*
  716. X   * date_string:
  717. X
  718. X--- 89,96 -----
  719. X          "Sunday", "Monday", "Tuesday", "Wednesday",
  720. X          "Thursday", "Friday", "Saturday"    };
  721. X  static char    timebuf[16];
  722. X+ static double    passoverJD, easterJD;
  723. X+ static int    passoverJY;
  724. X  
  725. X  /*
  726. X   * date_string:
  727. X***************
  728. X*** 254,259
  729. X  }
  730. X  
  731. X  /*
  732. X   * julian_day:
  733. X   * Compute Julian day (>=1)
  734. X   * given day (1-31), month (1-12), year (1901-2009)
  735. X
  736. X--- 256,289 -----
  737. X  }
  738. X  
  739. X  /*
  740. X+  * nth_mday_of_month:
  741. X+  * Compute nth m-day of the month (1-31)
  742. X+  * given n (1-5), day of week (0-6, 0 for Sunday), month (1-12),
  743. X+  * year (1583-9999)
  744. X+  */
  745. X+ double
  746. X+ nth_mday_of_month(n, day_of_week, month, year)
  747. X+     int    day_of_week, month, n, year;
  748. X+ {
  749. X+     int    atmp, btmp, ctmp, dtmp, etmp, tmonth, tyear;
  750. X+ 
  751. X+     if (month > 2) {
  752. X+         tmonth = month + 1;
  753. X+         tyear = year;
  754. X+     }
  755. X+     else {
  756. X+         tmonth = month + 13;
  757. X+         tyear = year - 1;
  758. X+     }
  759. X+     atmp = 2.6 * tmonth;
  760. X+     btmp = 1.25 * tyear;
  761. X+     ctmp = (tyear / 100) - 7;
  762. X+     dtmp = 0.75 * ctmp;
  763. X+     etmp = (day_of_week - atmp - btmp + dtmp) % 7;
  764. X+     return (double) (etmp + (n * 7));
  765. X+ }
  766. X+ 
  767. X+ /*
  768. X   * julian_day:
  769. X   * Compute Julian day (>=1)
  770. X   * given day (1-31), month (1-12), year (1901-2009)
  771. X***************
  772. X*** 270,277
  773. X      double    day;
  774. X      int    month, year;
  775. X  {
  776. X!     int    atmp, btmp, monthp, yearp;
  777. X!     double    ctmp;
  778. X  
  779. X      if (month > 2) {
  780. X          monthp = month + 1;
  781. X
  782. X--- 300,307 -----
  783. X      double    day;
  784. X      int    month, year;
  785. X  {
  786. X!     int    atmp, monthp, yearp;
  787. X!     double    ctmp = 1720994.5 + day;
  788. X  
  789. X      if (month > 2) {
  790. X          monthp = month + 1;
  791. X***************
  792. X*** 282,288
  793. X          yearp = year - 1;
  794. X      }
  795. X      if ((year > 1582) || (year == 1582 && month >= 10)
  796. X!         || (year == 1582 && month ==10 && day >= 15)) {
  797. X          atmp = year / 100;
  798. X          btmp = 2 - atmp + (atmp / 4);
  799. X      }
  800. X
  801. X--- 312,318 -----
  802. X          yearp = year - 1;
  803. X      }
  804. X      if ((year > 1582) || (year == 1582 && month >= 10)
  805. X!         || (year == 1582 && month == 10 && day >= 15)) {
  806. X          atmp = year / 100;
  807. X          ctmp += 2 - atmp + (int)(atmp / 4);
  808. X      }
  809. X***************
  810. X*** 284,290
  811. X      if ((year > 1582) || (year == 1582 && month >= 10)
  812. X          || (year == 1582 && month ==10 && day >= 15)) {
  813. X          atmp = year / 100;
  814. X!         btmp = 2 - atmp + (atmp / 4);
  815. X      }
  816. X      else
  817. X          btmp = 0;
  818. X
  819. X--- 314,320 -----
  820. X      if ((year > 1582) || (year == 1582 && month >= 10)
  821. X          || (year == 1582 && month == 10 && day >= 15)) {
  822. X          atmp = year / 100;
  823. X!         ctmp += 2 - atmp + (int)(atmp / 4);
  824. X      }
  825. X      ctmp += (int)(365.25 * yearp) + (int)(30.6001 * monthp);
  826. X      return ctmp;
  827. X***************
  828. X*** 286,298
  829. X          atmp = year / 100;
  830. X          btmp = 2 - atmp + (atmp / 4);
  831. X      }
  832. X!     else
  833. X!         btmp = 0;
  834. X!     atmp = 365.25 * yearp;
  835. X!     ctmp = atmp;
  836. X!     atmp = 30.6001 * monthp;
  837. X!     ctmp =  ctmp + atmp;
  838. X!     return ctmp + day + 1720994.5 + btmp;
  839. X  }
  840. X  
  841. X  #ifndef NO_HOLIDAYS
  842. X
  843. X--- 316,323 -----
  844. X          atmp = year / 100;
  845. X          ctmp += 2 - atmp + (int)(atmp / 4);
  846. X      }
  847. X!     ctmp += (int)(365.25 * yearp) + (int)(30.6001 * monthp);
  848. X!     return ctmp;
  849. X  }
  850. X  
  851. X  #ifndef NO_HOLIDAYS
  852. X***************
  853. X*** 297,302
  854. X  
  855. X  #ifndef NO_HOLIDAYS
  856. X  /*
  857. X   * corrected_julian_day:
  858. X   * Correct Julian day (>=1) for conversion from JULIAN CALENDAR
  859. X   * to GREGORIAN CALENDAR.
  860. X
  861. X--- 322,341 -----
  862. X  
  863. X  #ifndef NO_HOLIDAYS
  864. X  /*
  865. X+  * datelib_int:
  866. X+  * Calculate often used quantities (e.g. Easter, Passover) as an
  867. X+  * optimization.
  868. X+  */
  869. X+ datelib_init(year)
  870. X+     int    year;
  871. X+ {
  872. X+     void passover_init(), easter_init();
  873. X+ 
  874. X+     easter_init(year);
  875. X+     passover_init(year);
  876. X+ }
  877. X+ 
  878. X+ /*
  879. X   * corrected_julian_day:
  880. X   * Correct Julian day (>=1) for conversion from JULIAN CALENDAR
  881. X   * to GREGORIAN CALENDAR.
  882. X***************
  883. X*** 374,411
  884. X  }
  885. X  
  886. X  /*
  887. X-  * nth_mday_of_month:
  888. X-  * Compute nth m-day of the month (1-31)
  889. X-  * given n (1-5), day of week (0-6, 0 for Sunday), month (1-12),
  890. X-  * year (1583-9999)
  891. X-  */
  892. X- double
  893. X- nth_mday_of_month(n, day_of_week, month, year)
  894. X-     int    day_of_week, month, n, year;
  895. X- {
  896. X-     int    atmp, btmp, ctmp, dtmp, etmp, ftmp, tmonth, tyear;
  897. X- 
  898. X-     if (month > 2) {
  899. X-         tmonth = month + 1;
  900. X-         tyear = year;
  901. X-     }
  902. X-     else {
  903. X-         tmonth = month + 13;
  904. X-         tyear = year - 1;
  905. X-     }
  906. X-     atmp = 2.6 * tmonth;
  907. X-     btmp = 1.25 * tyear;
  908. X-     ctmp = (tyear / 100) - 7;
  909. X-     dtmp = 0.75 * ctmp;
  910. X-     etmp = (day_of_week - atmp - btmp + dtmp) % 7;
  911. X-     if (etmp == 0)
  912. X-         ftmp = 7;
  913. X-     else
  914. X-         ftmp = etmp;
  915. X-     return (double) (ftmp + (n * 7));
  916. X- }
  917. X- 
  918. X- /*
  919. X   * years_date_is_mday:
  920. X   * Compute year(s) for which a given date is an m-day
  921. X   * given starting year, ending year,
  922. X
  923. X--- 413,418 -----
  924. X  }
  925. X  
  926. X  /*
  927. X   * years_date_is_mday:
  928. X   * Compute year(s) for which a given date is an m-day
  929. X   * given starting year, ending year,
  930. X***************
  931. X*** 698,705
  932. X   * Method valid for all dates in the Gregorian calendar
  933. X   * (from 15 October 1583 on)
  934. X   */
  935. X! double
  936. X! easter(year)
  937. X      int    year;
  938. X  {
  939. X      double    day;
  940. X
  941. X--- 705,712 -----
  942. X   * Method valid for all dates in the Gregorian calendar
  943. X   * (from 15 October 1583 on)
  944. X   */
  945. X! void
  946. X! easter_init(year)
  947. X      int    year;
  948. X  {
  949. X      double    day;
  950. X***************
  951. X*** 721,727
  952. X      mtmp = (atmp + (11 * htmp) + (22 * ltmp)) / 451;
  953. X      month = (htmp + ltmp - (7 * mtmp) + 114) / 31;
  954. X      day = ((htmp + ltmp - (7 * mtmp) + 114) % 31) + 1;
  955. X!     return julian_day(day, month, year);
  956. X  }
  957. X  
  958. X  /*
  959. X
  960. X--- 728,734 -----
  961. X      mtmp = (atmp + (11 * htmp) + (22 * ltmp)) / 451;
  962. X      month = (htmp + ltmp - (7 * mtmp) + 114) / 31;
  963. X      day = ((htmp + ltmp - (7 * mtmp) + 114) % 31) + 1;
  964. X!     easterJD = julian_day(day, month, year);
  965. X  }
  966. X  
  967. X  double
  968. X***************
  969. X*** 724,729
  970. X      return julian_day(day, month, year);
  971. X  }
  972. X  
  973. X  /*
  974. X   * first_sunday_advent:
  975. X   * Christian holidays: compute Julian day for First Sunday in Advent
  976. X
  977. X--- 731,743 -----
  978. X      easterJD = julian_day(day, month, year);
  979. X  }
  980. X  
  981. X+ double
  982. X+ easter(year)
  983. X+     int    year;
  984. X+ {
  985. X+     return easterJD;
  986. X+ }
  987. X+ 
  988. X  /*
  989. X   * first_sunday_advent:
  990. X   * Christian holidays: compute Julian day for First Sunday in Advent
  991. X***************
  992. X*** 755,763
  993. X      double    offset;
  994. X      int    year;
  995. X  {
  996. X!     double    easter();
  997. X! 
  998. X!     return easter(year) + offset;
  999. X  }
  1000. X  
  1001. X  /*
  1002. X
  1003. X--- 769,775 -----
  1004. X      double    offset;
  1005. X      int    year;
  1006. X  {
  1007. X!     return easterJD + offset;
  1008. X  }
  1009. X  
  1010. X  /*
  1011. X***************
  1012. X*** 1030,1038
  1013. X   * Floating point implementation by R.P.C. Rodgers; integer implementation
  1014. X   * (for faster calculation) by Amos Shapir (amos@nsc.com).
  1015. X   */
  1016. X! double
  1017. X! passover(year, jyear)
  1018. X!     int    *jyear, year;
  1019. X  {
  1020. X      int    etmp, p_day;
  1021. X      int    atmp, btmp, ctmp, day_of_week, dtmp, ftmp, gtmp;
  1022. X
  1023. X--- 1042,1050 -----
  1024. X   * Floating point implementation by R.P.C. Rodgers; integer implementation
  1025. X   * (for faster calculation) by Amos Shapir (amos@nsc.com).
  1026. X   */
  1027. X! void
  1028. X! passover_init(year)
  1029. X!     int    year;
  1030. X  {
  1031. X      int    etmp, p_day;
  1032. X      int    atmp, btmp, ctmp, day_of_week, dtmp, ftmp, gtmp;
  1033. X***************
  1034. X*** 1039,1045
  1035. X      int    p_month;
  1036. X  
  1037. X      atmp = year + 3760;
  1038. X!     *jyear = atmp;
  1039. X      btmp = (12 * atmp + 17) % 19;
  1040. X      ctmp = atmp % 4;
  1041. X      etmp = (765433 * btmp) - (1565 * atmp)
  1042. X
  1043. X--- 1051,1057 -----
  1044. X      int    p_month;
  1045. X  
  1046. X      atmp = year + 3760;
  1047. X!     passoverJY = atmp;
  1048. X      btmp = (12 * atmp + 17) % 19;
  1049. X      ctmp = atmp % 4;
  1050. X      etmp = (765433 * btmp) - (1565 * atmp)
  1051. X***************
  1052. X*** 1049,1055
  1053. X          /* day_of_week is not to be confused with the
  1054. X           value returned by the day_of_week routine; here, Sunday = 1 */
  1055. X      day_of_week = ((3 * atmp) + (5 * ctmp) + dtmp + 5) % 7;
  1056. X!     if (day_of_week == 0 && btmp > 11 && etmp >= 311676)
  1057. X          p_day = dtmp + 1;
  1058. X      else if (day_of_week == 1 && btmp > 6 && etmp >= 311676)
  1059. X          p_day = dtmp + 2;
  1060. X
  1061. X--- 1061,1067 -----
  1062. X          /* day_of_week is not to be confused with the
  1063. X           value returned by the day_of_week routine; here, Sunday = 1 */
  1064. X      day_of_week = ((3 * atmp) + (5 * ctmp) + dtmp + 5) % 7;
  1065. X!     if (day_of_week == 0 && btmp > 11 && etmp >= 442111)
  1066. X          p_day = dtmp + 1;
  1067. X      else if (day_of_week == 1 && btmp > 6 && etmp >= 311676)
  1068. X          p_day = dtmp + 2;
  1069. X***************
  1070. X*** 1067,1073
  1071. X          }
  1072. X      else
  1073. X          p_month = 3;
  1074. X!     return julian_day(p_day, p_month, year);
  1075. X  }
  1076. X  
  1077. X  /*
  1078. X
  1079. X--- 1079,1085 -----
  1080. X          }
  1081. X      else
  1082. X          p_month = 3;
  1083. X!     passoverJD = julian_day((double)p_day, p_month, year);
  1084. X  }
  1085. X  
  1086. X  double
  1087. X***************
  1088. X*** 1070,1075
  1089. X      return julian_day(p_day, p_month, year);
  1090. X  }
  1091. X  
  1092. X  /*
  1093. X   * passover_offset:
  1094. X   * Jewish holidays: compute Julian day as offset from Passover
  1095. X
  1096. X--- 1082,1095 -----
  1097. X      passoverJD = julian_day((double)p_day, p_month, year);
  1098. X  }
  1099. X  
  1100. X+ double
  1101. X+ passover(year, jyear)
  1102. X+     int year, *jyear;
  1103. X+ {
  1104. X+     *jyear = passoverJY;
  1105. X+     return passoverJD;
  1106. X+ }
  1107. X+ 
  1108. X  /*
  1109. X   * passover_offset:
  1110. X   * Jewish holidays: compute Julian day as offset from Passover
  1111. X***************
  1112. X*** 1080,1088
  1113. X      double    offset;
  1114. X      int    *jyear, year;
  1115. X  {
  1116. X!     double    passover();
  1117. X! 
  1118. X!     return passover(year, jyear) + offset;
  1119. X  }
  1120. X  
  1121. X  /*
  1122. X
  1123. X--- 1100,1107 -----
  1124. X      double    offset;
  1125. X      int    *jyear, year;
  1126. X  {
  1127. X!     *jyear = passoverJY;
  1128. X!     return passoverJD + offset;
  1129. X  }
  1130. X  
  1131. X  /*
  1132. X***************
  1133. X*** 1178,1185
  1134. X  chanukah(year, jyear)
  1135. X      int    *jyear, year;
  1136. X  {
  1137. X!     double    atmp;
  1138. X!     int    btmp, dummy;
  1139. X  
  1140. X      atmp = passover(year, jyear);
  1141. X      btmp = passover((year + 1), &dummy) - atmp;
  1142. X
  1143. X--- 1197,1204 -----
  1144. X  chanukah(year, jyear)
  1145. X      int    *jyear, year;
  1146. X  {
  1147. X!     double    atmp, ptmp;
  1148. X!     int    btmp, ytmp;
  1149. X  
  1150. X      atmp = passover(year, jyear);
  1151. X      /* we need top compute passover for next year, so
  1152. X***************
  1153. X*** 1182,1188
  1154. X      int    btmp, dummy;
  1155. X  
  1156. X      atmp = passover(year, jyear);
  1157. X!     btmp = passover((year + 1), &dummy) - atmp;
  1158. X      (*jyear)++;
  1159. X      if (btmp == 355 || btmp == 385)
  1160. X          return atmp + 247.0;
  1161. X
  1162. X--- 1201,1215 -----
  1163. X      int    btmp, ytmp;
  1164. X  
  1165. X      atmp = passover(year, jyear);
  1166. X!     /* we need top compute passover for next year, so
  1167. X!      * save current info and restore when done
  1168. X!      */
  1169. X!     ptmp = passoverJD;
  1170. X!     ytmp = passoverJY;
  1171. X!     passover_init(year + 1);
  1172. X!     btmp = passoverJD - atmp;
  1173. X!     passoverJD = ptmp;
  1174. X!     passoverJY = ytmp;
  1175. X      (*jyear)++;
  1176. X      if (btmp == 355 || btmp == 385)
  1177. X          return atmp + 247.0;
  1178. X*** /tmp/,RCSt1a16926    Fri Dec 15 17:22:44 1989
  1179. X--- devent.c    Fri Dec 15 17:17:23 1989
  1180. X***************
  1181. X*** 1,5
  1182. X  /*
  1183. X!  * $Header: devent.c,v 2.5 89/09/19 05:58:58 billr Exp $
  1184. X   */
  1185. X  /*
  1186. X   * devent.c
  1187. X
  1188. X--- 1,5 -----
  1189. X  /*
  1190. X!  * $Header: devent.c,v 2.6 89/12/15 17:17:18 billr Exp $
  1191. X   */
  1192. X  /*
  1193. X   * devent.c
  1194. X***************
  1195. X*** 43,48
  1196. X  extern Panel_item everyx_pi, repeat_pi, remind_pi;
  1197. X  extern Panel_item whichwk_pi, marked_pi;
  1198. X  extern Panel_item del_choice_pi;
  1199. X  extern Frame del_frame;
  1200. X  extern Panel del_panel;
  1201. X  extern Pixrect tri_right_pr, tri_up_pr;
  1202. X
  1203. X--- 43,49 -----
  1204. X  extern Panel_item everyx_pi, repeat_pi, remind_pi;
  1205. X  extern Panel_item whichwk_pi, marked_pi;
  1206. X  extern Panel_item del_choice_pi;
  1207. X+ extern Panel_item runl_pi;
  1208. X  extern Frame del_frame;
  1209. X  extern Panel del_panel;
  1210. X  extern Pixrect tri_right_pr, tri_up_pr;
  1211. X***************
  1212. X*** 463,469
  1213. X  
  1214. X  /* clears a day slot */
  1215. X  deactivate_slot(bi, dpyflag)
  1216. X! int bi;
  1217. X  {
  1218. X      slots[bi].active = INACTIVE;
  1219. X      if (!dpyflag)
  1220. X
  1221. X--- 464,470 -----
  1222. X  
  1223. X  /* clears a day slot */
  1224. X  deactivate_slot(bi, dpyflag)
  1225. X! int bi, dpyflag;
  1226. X  {
  1227. X      slots[bi].active = INACTIVE;
  1228. X      if (!dpyflag)
  1229. X***************
  1230. X*** 485,491
  1231. X  /* returns pointer to slot containing arrow head */
  1232. X  int
  1233. X  deactivate_lower_arrows(bi, dpyflag)
  1234. X! int bi;
  1235. X  {
  1236. X      while (bi < N_SLOTS-1) {
  1237. X          bi++;
  1238. X
  1239. X--- 486,492 -----
  1240. X  /* returns pointer to slot containing arrow head */
  1241. X  int
  1242. X  deactivate_lower_arrows(bi, dpyflag)
  1243. X! int bi, dpyflag;
  1244. X  {
  1245. X      while (bi < N_SLOTS-1) {
  1246. X          bi++;
  1247. X***************
  1248. X*** 517,522
  1249. X      slots[bi].cur_appt->arrows = 0;
  1250. X      slots[bi].cur_appt->flags = slots[bi].cur_appt->repeat = 0;
  1251. X      slots[bi].cur_appt->lookahead = slots[bi].cur_appt->sindex = 0;
  1252. X      if (bi >= n_tslots) {
  1253. X          /* notes section */
  1254. X          slots[bi].cur_appt->hour = 99;
  1255. X
  1256. X--- 518,524 -----
  1257. X      slots[bi].cur_appt->arrows = 0;
  1258. X      slots[bi].cur_appt->flags = slots[bi].cur_appt->repeat = 0;
  1259. X      slots[bi].cur_appt->lookahead = slots[bi].cur_appt->sindex = 0;
  1260. X+     slots[bi].cur_appt->runlength = 0;
  1261. X      if (bi >= n_tslots) {
  1262. X          /* notes section */
  1263. X          slots[bi].cur_appt->hour = 99;
  1264. X***************
  1265. X*** 756,761
  1266. X  
  1267. X      panel_set_value(repeat_pi, "");    /* set default */
  1268. X      panel_set_value(remind_pi, "");    /* set default */
  1269. X      if (apt->flags & ALL_DAYS)
  1270. X          everyx_val |= 0x1;
  1271. X      if (apt->flags & ALL_MONTHS)
  1272. X
  1273. X--- 758,764 -----
  1274. X  
  1275. X      panel_set_value(repeat_pi, "");    /* set default */
  1276. X      panel_set_value(remind_pi, "");    /* set default */
  1277. X+     panel_set_value(runl_pi, "");    /* set default */
  1278. X      if (apt->flags & ALL_DAYS)
  1279. X          everyx_val |= 0x1;
  1280. X      if (apt->flags & ALL_MONTHS)
  1281. X***************
  1282. X*** 780,785
  1283. X      if (apt->flags & LOOKAHEAD) {
  1284. X          sprintf(str, "%d", apt->lookahead);
  1285. X          panel_set_value(remind_pi, str);
  1286. X      }
  1287. X      panel_set_value(marked_pi, (apt->flags & MARKED ? 1 : 0));
  1288. X      if (apt->flags & A_NOTE)
  1289. X
  1290. X--- 783,792 -----
  1291. X      if (apt->flags & LOOKAHEAD) {
  1292. X          sprintf(str, "%d", apt->lookahead);
  1293. X          panel_set_value(remind_pi, str);
  1294. X+     }
  1295. X+     if (apt->flags & RUN) {
  1296. X+         sprintf(str, "%d", apt->runlength);
  1297. X+         panel_set_value(runl_pi, str);
  1298. X      }
  1299. X      panel_set_value(marked_pi, (apt->flags & MARKED ? 1 : 0));
  1300. X      if (apt->flags & A_NOTE)
  1301. X*** /tmp/,RCSt1a16931    Fri Dec 15 17:22:51 1989
  1302. X--- dpaint.c    Fri Dec 15 17:17:29 1989
  1303. X***************
  1304. X*** 1,5
  1305. X  /*
  1306. X!  * $Header: dpaint.c,v 2.3 89/07/19 20:27:45 billr Exp $
  1307. X   */
  1308. X  /*
  1309. X   * dpaint.c
  1310. X
  1311. X--- 1,5 -----
  1312. X  /*
  1313. X!  * $Header: dpaint.c,v 2.4 89/12/15 17:17:25 billr Exp $
  1314. X   */
  1315. X  /*
  1316. X   * dpaint.c
  1317. X***************
  1318. X*** 28,35
  1319. X   *                           *
  1320. X   ***************************************************/
  1321. X  
  1322. X- #include <suntool/sunview.h>
  1323. X- #include <suntool/canvas.h>
  1324. X  #include <ctype.h>
  1325. X  #include <sys/time.h>
  1326. X  #include <stdio.h>
  1327. X
  1328. X--- 28,33 -----
  1329. X   *                           *
  1330. X   ***************************************************/
  1331. X  
  1332. X  #include <ctype.h>
  1333. X  #include <sys/time.h>
  1334. X  #include <stdio.h>
  1335. X***************
  1336. X*** 33,38
  1337. X  #include <ctype.h>
  1338. X  #include <sys/time.h>
  1339. X  #include <stdio.h>
  1340. X  #include "ct.h"
  1341. X  #include "paint.h"
  1342. X  #include "riseset.h"
  1343. X
  1344. X--- 31,40 -----
  1345. X  #include <ctype.h>
  1346. X  #include <sys/time.h>
  1347. X  #include <stdio.h>
  1348. X+ #ifndef NOTOOL
  1349. X+ #include <suntool/sunview.h>
  1350. X+ #include <suntool/canvas.h>
  1351. X+ #endif
  1352. X  #include "ct.h"
  1353. X  #include "paint.h"
  1354. X  #ifndef NOTOOL
  1355. X***************
  1356. X*** 35,40
  1357. X  #include <stdio.h>
  1358. X  #include "ct.h"
  1359. X  #include "paint.h"
  1360. X  #include "riseset.h"
  1361. X  #define J1970   2440587.5 /* VAX clock Epoch 1970 Jan 1 (0h UT) */
  1362. X  
  1363. X
  1364. X--- 37,43 -----
  1365. X  #endif
  1366. X  #include "ct.h"
  1367. X  #include "paint.h"
  1368. X+ #ifndef NOTOOL
  1369. X  #include "riseset.h"
  1370. X  #define J1970   2440587.5 /* VAX clock Epoch 1970 Jan 1 (0h UT) */
  1371. X  
  1372. X***************
  1373. X*** 42,48
  1374. X  extern Frame mframe, sframe;
  1375. X  extern Canvas mcanvas, scanvas;
  1376. X  extern Panel_item mdate_pi, sdate_pi;
  1377. X! #endif
  1378. X  extern Pixrect *leftarrow, *rightarrow;
  1379. X  extern Pixrect *arrowshaft_pr, *arrowhead_pr;
  1380. X  extern int day_message_size;
  1381. X
  1382. X--- 45,51 -----
  1383. X  extern Frame mframe, sframe;
  1384. X  extern Canvas mcanvas, scanvas;
  1385. X  extern Panel_item mdate_pi, sdate_pi;
  1386. X! #endif  /* NO_SUN_MOON */
  1387. X  extern Pixrect *leftarrow, *rightarrow;
  1388. X  extern Pixrect *arrowshaft_pr, *arrowhead_pr;
  1389. X  extern char riseset_buf[][64];
  1390. X***************
  1391. X*** 45,51
  1392. X  #endif
  1393. X  extern Pixrect *leftarrow, *rightarrow;
  1394. X  extern Pixrect *arrowshaft_pr, *arrowhead_pr;
  1395. X- extern int day_message_size;
  1396. X  extern char riseset_buf[][64];
  1397. X  extern int old_slot;
  1398. X  extern int show_future;
  1399. X
  1400. X--- 48,53 -----
  1401. X  #endif  /* NO_SUN_MOON */
  1402. X  extern Pixrect *leftarrow, *rightarrow;
  1403. X  extern Pixrect *arrowshaft_pr, *arrowhead_pr;
  1404. X  extern char riseset_buf[][64];
  1405. X  extern int old_slot;
  1406. X  #endif  /* NOTOOL */
  1407. X***************
  1408. X*** 48,53
  1409. X  extern int day_message_size;
  1410. X  extern char riseset_buf[][64];
  1411. X  extern int old_slot;
  1412. X  extern int show_future;
  1413. X  extern char *index();
  1414. X  
  1415. X
  1416. X--- 50,57 -----
  1417. X  extern Pixrect *arrowshaft_pr, *arrowhead_pr;
  1418. X  extern char riseset_buf[][64];
  1419. X  extern int old_slot;
  1420. X+ #endif  /* NOTOOL */
  1421. X+ extern int day_message_size;
  1422. X  extern int show_future;
  1423. X  extern char *index();
  1424. X  
  1425. X***************
  1426. X*** 55,60
  1427. X  struct appt_entry future[MAX_FUTURE_ENTRIES];
  1428. X  int findex = 0;        /* index into struct future array */
  1429. X  
  1430. X  /*
  1431. X   * This one draws the current selected day in the
  1432. X   * main subwindow.
  1433. X
  1434. X--- 59,65 -----
  1435. X  struct appt_entry future[MAX_FUTURE_ENTRIES];
  1436. X  int findex = 0;        /* index into struct future array */
  1437. X  
  1438. X+ #ifndef NOTOOL
  1439. X  /*
  1440. X   * This one draws the current selected day in the
  1441. X   * main subwindow.
  1442. X***************
  1443. X*** 116,125
  1444. X      starty = y = (rect->r_height - (N_SLOTS * dayslot_height)) / 2;
  1445. X  
  1446. X      /* Format daystring to say, for example, */
  1447. X!     /* Tuesday, March 12, 1985 */
  1448. X!     sprintf(daystring, "%s %s %d, %d",
  1449. X!         daynames[current.tm_wday], monthnames[current.tm_mon],
  1450. X!         current.tm_mday, 1900 + current.tm_year);
  1451. X      pw_text(main_pixwin, (rect->r_width - bigfont->pf_defaultsize.x*strlen(daystring))/2, starty/2 + 7,
  1452. X        PIX_SRC, bigfont, daystring);
  1453. X  
  1454. X
  1455. X--- 121,136 -----
  1456. X      starty = y = (rect->r_height - (N_SLOTS * dayslot_height)) / 2;
  1457. X  
  1458. X      /* Format daystring to say, for example, */
  1459. X!     if (day_first)
  1460. X!         /* Tuesday, 13 March 1990 */
  1461. X!         sprintf(daystring, "%s %d %s %d",
  1462. X!             daynames[current.tm_wday], current.tm_mday,
  1463. X!             monthnames[current.tm_mon], 1900 + current.tm_year);
  1464. X!     else
  1465. X!         /* Tuesday, March 13, 1990 */
  1466. X!         sprintf(daystring, "%s %s %d, %d",
  1467. X!             daynames[current.tm_wday], monthnames[current.tm_mon],
  1468. X!             current.tm_mday, 1900 + current.tm_year);
  1469. X      pw_text(main_pixwin, (rect->r_width - bigfont->pf_defaultsize.x*strlen(daystring))/2, starty/2 + 7,
  1470. X        PIX_SRC, bigfont, daystring);
  1471. X  
  1472. X***************
  1473. X*** 146,154
  1474. X              pw_write(main_pixwin,x,y,dayslot_width,dayslot_height,PIX_SRC,timeslot_pr,0,0);
  1475. X          if (i < n_tslots) {
  1476. X              /* display time */
  1477. X!             sprintf(timestring, "%2d:%s",
  1478. X!                 (START_HOUR+(i/2))%12 == 0 ? 12 : (START_HOUR+(i/2))%12,
  1479. X!                 i%2 == 0 ? "00" : "30");
  1480. X          } else if (i == n_tslots) {
  1481. X              sprintf(timestring, "Notes");
  1482. X          } else {
  1483. X
  1484. X--- 157,170 -----
  1485. X              pw_write(main_pixwin,x,y,dayslot_width,dayslot_height,PIX_SRC,timeslot_pr,0,0);
  1486. X          if (i < n_tslots) {
  1487. X              /* display time */
  1488. X!             if (hour24)
  1489. X!                 sprintf(timestring, "%2d:%s",
  1490. X!                     START_HOUR+(i/2),
  1491. X!                     i%2 == 0 ? "00" : "30");
  1492. X!             else
  1493. X!                 sprintf(timestring, "%2d:%s%s",
  1494. X!                     (START_HOUR+(i/2))%12 == 0 ? 12 : (START_HOUR+(i/2))%12,
  1495. X!                     i%2 == 0 ? "00" : "30", (START_HOUR+(i/2) < 12 ? "am" : "pm"));
  1496. X          } else if (i == n_tslots) {
  1497. X              sprintf(timestring, "Notes");
  1498. X          } else {
  1499. X***************
  1500. X*** 154,160
  1501. X          } else {
  1502. X              sprintf(timestring, "     ");
  1503. X          }
  1504. X!         pw_text(main_pixwin,x-8*font->pf_defaultsize.x,y+font->pf_defaultsize.y,PIX_SRC,font,timestring);
  1505. X          y += dayslot_height - 1;
  1506. X      }
  1507. X  
  1508. X
  1509. X--- 170,176 -----
  1510. X          } else {
  1511. X              sprintf(timestring, "     ");
  1512. X          }
  1513. X!         pw_text(main_pixwin,x-9*font->pf_defaultsize.x,y+font->pf_defaultsize.y,PIX_SRC,font,timestring);
  1514. X          y += dayslot_height - 1;
  1515. X      }
  1516. X  
  1517. X***************
  1518. X*** 168,173
  1519. X      sun_moon_buttons(TRUE);
  1520. X      print_button(TRUE);
  1521. X  }
  1522. X  
  1523. X  
  1524. X  /*
  1525. X
  1526. X--- 184,190 -----
  1527. X      sun_moon_buttons(TRUE);
  1528. X      print_button(TRUE);
  1529. X  }
  1530. X+ #endif  /* NOTOOL */
  1531. X  
  1532. X  /*
  1533. X   * Fills in appointments for the day.  
  1534. X***************
  1535. X*** 169,175
  1536. X      print_button(TRUE);
  1537. X  }
  1538. X  
  1539. X- 
  1540. X  /*
  1541. X   * Fills in appointments for the day.  
  1542. X   * The ".tmp.aptsXXXXX" file is filled out
  1543. X
  1544. X--- 186,191 -----
  1545. X  }
  1546. X  #endif  /* NOTOOL */
  1547. X  
  1548. X  /*
  1549. X   * Fills in appointments for the day.  
  1550. X   * The ".tmp.aptsXXXXX" file is filled out
  1551. X***************
  1552. X*** 182,187
  1553. X      FILE *apts, *temp_apts;
  1554. X      int slotno, n_arrows, i;
  1555. X      int read_stat, some_appt = 0;
  1556. X      struct appt_entry appt;
  1557. X      struct appt_entry *nappt, *aptr;
  1558. X      char buf[MAX_STRLEN], *sptr;
  1559. X
  1560. X--- 198,204 -----
  1561. X      FILE *apts, *temp_apts;
  1562. X      int slotno, n_arrows, i;
  1563. X      int read_stat, some_appt = 0;
  1564. X+     int runl;
  1565. X      struct appt_entry appt;
  1566. X      struct appt_entry *nappt, *aptr;
  1567. X      char buf[MAX_STRLEN], *sptr;
  1568. X***************
  1569. X*** 235,241
  1570. X      /*
  1571. X       * now go thru the appointments file
  1572. X       */
  1573. X!     while ((read_stat=get_aentry(apts, &appt)) != EOF) {
  1574. X          if (read_stat)
  1575. X              continue;    /* read error (ignore) */
  1576. X          if (appt.flags & A_COMMENT) {
  1577. X
  1578. X--- 252,258 -----
  1579. X      /*
  1580. X       * now go thru the appointments file
  1581. X       */
  1582. X!     while ((read_stat=get_aentry(apts, &appt, FALSE)) != EOF) {
  1583. X          if (read_stat)
  1584. X              continue;    /* read error (ignore) */
  1585. X          if (appt.flags & A_COMMENT) {
  1586. X***************
  1587. X*** 256,263
  1588. X              current.tm_mday = First.tm_mday;
  1589. X          else if (appt.flags & EVERY_SOMEDAY) {
  1590. X              if (Pickday(appt.flags) == First.tm_wday) {
  1591. X!                 if (chk_week(appt.repeat, First.tm_mday))
  1592. X!                     current.tm_mday = First.tm_mday;
  1593. X              }
  1594. X          } else if (appt.flags & REPEAT) {
  1595. X              while (ymd_compare(current, First) < 0) {
  1596. X
  1597. X--- 273,284 -----
  1598. X              current.tm_mday = First.tm_mday;
  1599. X          else if (appt.flags & EVERY_SOMEDAY) {
  1600. X              if (Pickday(appt.flags) == First.tm_wday) {
  1601. X!                 if (chk_week(appt.repeat, First.tm_mday)) {
  1602. X!                     if (appt.flags & RUN)
  1603. X!                         find_date(&appt);
  1604. X!                     else
  1605. X!                         current.tm_mday = First.tm_mday;
  1606. X!                 }
  1607. X              }
  1608. X          } else if (appt.flags & REPEAT) {
  1609. X              if (appt.flags & RUN)
  1610. X***************
  1611. X*** 260,268
  1612. X                      current.tm_mday = First.tm_mday;
  1613. X              }
  1614. X          } else if (appt.flags & REPEAT) {
  1615. X!             while (ymd_compare(current, First) < 0) {
  1616. X!                 current.tm_mday += appt.repeat;
  1617. X!                 fix_current_day();
  1618. X              }
  1619. X          }
  1620. X          if (ymd_compare(current, First) == 0) {
  1621. X
  1622. X--- 281,297 -----
  1623. X                  }
  1624. X              }
  1625. X          } else if (appt.flags & REPEAT) {
  1626. X!             if (appt.flags & RUN)
  1627. X!                 runl = appt.runlength;
  1628. X!             else
  1629. X!                 runl = 1;
  1630. X!             while (ymd_compare(current, First) < 0 && runl) {
  1631. X!                 if (appt.flags & RUN)
  1632. X!                     --runl;
  1633. X!                 if (runl) {
  1634. X!                     current.tm_mday += appt.repeat;
  1635. X!                     fix_current_day();
  1636. X!                 }
  1637. X              }
  1638. X          }
  1639. X          if (ymd_compare(current, First) == 0) {
  1640. X***************
  1641. X*** 267,273
  1642. X          }
  1643. X          if (ymd_compare(current, First) == 0) {
  1644. X              /* if it's for this day, fill in slot info */
  1645. X!             if (appt.flags & A_NOTE)
  1646. X                  /* notes section */
  1647. X                  add_note(&appt);
  1648. X              else {
  1649. X
  1650. X--- 296,302 -----
  1651. X          }
  1652. X          if (ymd_compare(current, First) == 0) {
  1653. X              /* if it's for this day, fill in slot info */
  1654. X!             if (appt.flags & A_NOTE) {
  1655. X                  /* notes section */
  1656. X                  add_note(&appt);
  1657. X                  if (appt.flags & MARKED)
  1658. X***************
  1659. X*** 270,276
  1660. X              if (appt.flags & A_NOTE)
  1661. X                  /* notes section */
  1662. X                  add_note(&appt);
  1663. X!             else {
  1664. X                  /* regular appointment */
  1665. X                  slotno = (appt.hour-START_HOUR) * 2 + appt.minute / 30;
  1666. X                  if (slotno < 0)
  1667. X
  1668. X--- 299,311 -----
  1669. X              if (appt.flags & A_NOTE) {
  1670. X                  /* notes section */
  1671. X                  add_note(&appt);
  1672. X!                 if (appt.flags & MARKED)
  1673. X!                     /* marked note */
  1674. X!                     some_appt |= SOME_MKNOTES;
  1675. X!                 else
  1676. X!                     /* regular note */
  1677. X!                     some_appt |= SOME_NOTES;
  1678. X!             } else {
  1679. X                  /* regular appointment */
  1680. X                  slotno = (appt.hour-START_HOUR) * 2 + appt.minute / 30;
  1681. X                  if (slotno < 0)
  1682. X***************
  1683. X*** 280,285
  1684. X                  /* add this appt to the list of appts for the slot */
  1685. X                  /* and update all the reference counts */
  1686. X                  add_to_slot(slotno, &appt, FALSE);
  1687. X              }
  1688. X          } else if (appt.flags & LOOKAHEAD) {
  1689. X              /* This lookahead appt was not for today, so
  1690. X
  1691. X--- 315,321 -----
  1692. X                  /* add this appt to the list of appts for the slot */
  1693. X                  /* and update all the reference counts */
  1694. X                  add_to_slot(slotno, &appt, FALSE);
  1695. X+                 some_appt |= SOME_APPTS;
  1696. X              }
  1697. X          } else if (appt.flags & LOOKAHEAD) {
  1698. X              /* This lookahead appt was not for today, so
  1699. X***************
  1700. X*** 316,321
  1701. X                      future[findex].month = save_day.tm_mon;
  1702. X                      future[findex].day = save_day.tm_mday;
  1703. X                      ++findex;
  1704. X                  }
  1705. X              }
  1706. X                  } else {     /* line is not for today */
  1707. X
  1708. X--- 352,358 -----
  1709. X                      future[findex].month = save_day.tm_mon;
  1710. X                      future[findex].day = save_day.tm_mday;
  1711. X                      ++findex;
  1712. X+                     some_appt |= SOME_FUTURES;
  1713. X                  }
  1714. X              }
  1715. X                  } else {     /* line is not for today */
  1716. X***************
  1717. X*** 334,350
  1718. X          fclose(apts);             
  1719. X      current = First;
  1720. X      fix_current_day();
  1721. X!     /* now check to see if there is anything happening this day */
  1722. X!     if (findex)
  1723. X!         some_appt = 1;
  1724. X!     else {
  1725. X!         for (i=0; i<N_SLOTS; i++) {
  1726. X!             if (slots[i].count > 0) {
  1727. X!                 some_appt = 1;
  1728. X!                 break;
  1729. X!             }
  1730. X!         }
  1731. X!     }
  1732. X      return(some_appt);
  1733. X  }
  1734. X  
  1735. X
  1736. X--- 371,377 -----
  1737. X          fclose(apts);             
  1738. X      current = First;
  1739. X      fix_current_day();
  1740. X! 
  1741. X      return(some_appt);
  1742. X  }
  1743. X  
  1744. X***************
  1745. X*** 380,385
  1746. X  struct appt_entry *appt;
  1747. X  {
  1748. X      struct tm save;
  1749. X  
  1750. X      save = current;
  1751. X      /* set current to match dow of repeated appt */
  1752. X
  1753. X--- 407,413 -----
  1754. X  struct appt_entry *appt;
  1755. X  {
  1756. X      struct tm save;
  1757. X+     int runl;
  1758. X  
  1759. X      save = current;
  1760. X      /* set current to match dow of repeated appt */
  1761. X***************
  1762. X*** 390,395
  1763. X          current.tm_mday += 7;
  1764. X          fix_current_day();
  1765. X      }
  1766. X      /* search for first matching week */
  1767. X      while (!chk_week(appt->repeat, current.tm_mday)) {
  1768. X          current.tm_mday += 7;
  1769. X
  1770. X--- 418,427 -----
  1771. X          current.tm_mday += 7;
  1772. X          fix_current_day();
  1773. X      }
  1774. X+     if (appt->flags & RUN)
  1775. X+         runl = appt->runlength;
  1776. X+     else
  1777. X+         runl = 1;
  1778. X      /* search for first matching week */
  1779. X      while (!chk_week(appt->repeat, current.tm_mday) && runl) {
  1780. X          current.tm_mday += 7;
  1781. X***************
  1782. X*** 391,397
  1783. X          fix_current_day();
  1784. X      }
  1785. X      /* search for first matching week */
  1786. X!     while (!chk_week(appt->repeat, current.tm_mday)) {
  1787. X          current.tm_mday += 7;
  1788. X          fix_current_day();
  1789. X      }
  1790. X
  1791. X--- 423,429 -----
  1792. X      else
  1793. X          runl = 1;
  1794. X      /* search for first matching week */
  1795. X!     while (!chk_week(appt->repeat, current.tm_mday) && runl) {
  1796. X          current.tm_mday += 7;
  1797. X          fix_current_day();
  1798. X          if (appt->flags & RUN)
  1799. X***************
  1800. X*** 394,399
  1801. X      while (!chk_week(appt->repeat, current.tm_mday)) {
  1802. X          current.tm_mday += 7;
  1803. X          fix_current_day();
  1804. X      }
  1805. X      /* now check to make sure this is legal, i.e. there
  1806. X       * were no month or year restrictions
  1807. X
  1808. X--- 426,433 -----
  1809. X      while (!chk_week(appt->repeat, current.tm_mday) && runl) {
  1810. X          current.tm_mday += 7;
  1811. X          fix_current_day();
  1812. X+         if (appt->flags & RUN)
  1813. X+             --runl;
  1814. X      }
  1815. X      /* now check to make sure this is legal, i.e. there
  1816. X       * were no month or year restrictions and runlength
  1817. X***************
  1818. X*** 396,402
  1819. X          fix_current_day();
  1820. X      }
  1821. X      /* now check to make sure this is legal, i.e. there
  1822. X!      * were no month or year restrictions
  1823. X       */
  1824. X      if ((!(appt->flags & ALL_YEARS) && current.tm_year != save.tm_year)
  1825. X         || (!(appt->flags & ALL_MONTHS) && current.tm_mon != save.tm_mon))
  1826. X
  1827. X--- 430,437 -----
  1828. X              --runl;
  1829. X      }
  1830. X      /* now check to make sure this is legal, i.e. there
  1831. X!      * were no month or year restrictions and runlength
  1832. X!      * wasn't exceeded
  1833. X       */
  1834. X      if (!runl || (!(appt->flags & ALL_YEARS) && current.tm_year != save.tm_year)
  1835. X         || (!(appt->flags & ALL_MONTHS) && current.tm_mon != save.tm_mon))
  1836. X***************
  1837. X*** 398,404
  1838. X      /* now check to make sure this is legal, i.e. there
  1839. X       * were no month or year restrictions
  1840. X       */
  1841. X!     if ((!(appt->flags & ALL_YEARS) && current.tm_year != save.tm_year)
  1842. X         || (!(appt->flags & ALL_MONTHS) && current.tm_mon != save.tm_mon))
  1843. X          /* invalid date, due to month or year wrap */
  1844. X          current = save;
  1845. X
  1846. X--- 433,439 -----
  1847. X       * were no month or year restrictions and runlength
  1848. X       * wasn't exceeded
  1849. X       */
  1850. X!     if (!runl || (!(appt->flags & ALL_YEARS) && current.tm_year != save.tm_year)
  1851. X         || (!(appt->flags & ALL_MONTHS) && current.tm_mon != save.tm_mon))
  1852. X          /* invalid date, due to month or year wrap */
  1853. X          current = save;
  1854. X***************
  1855. X*** 409,415
  1856. X  add_note(appt)
  1857. X  struct appt_entry *appt;
  1858. X  {
  1859. X!     int    slotno;
  1860. X  
  1861. X      /* auto-hunt for free note slot */
  1862. X      for (slotno=n_tslots; slotno<N_SLOTS; slotno++)
  1863. X
  1864. X--- 444,451 -----
  1865. X  add_note(appt)
  1866. X  struct appt_entry *appt;
  1867. X  {
  1868. X!     int    slotno, found = 0;
  1869. X!     struct appt_entry *optr;
  1870. X  
  1871. X      /* This used to just find a free slot and add the note
  1872. X       * to it. However, with deleted notes we need to find
  1873. X***************
  1874. X*** 411,420
  1875. X  {
  1876. X      int    slotno;
  1877. X  
  1878. X!     /* auto-hunt for free note slot */
  1879. X!     for (slotno=n_tslots; slotno<N_SLOTS; slotno++)
  1880. X!         if (slots[slotno].active == INACTIVE)
  1881. X!             break;
  1882. X      if (slotno == N_SLOTS) {
  1883. X          /* overflow of notes field, so
  1884. X           * add to last note field list
  1885. X
  1886. X--- 447,484 -----
  1887. X      int    slotno, found = 0;
  1888. X      struct appt_entry *optr;
  1889. X  
  1890. X!     /* This used to just find a free slot and add the note
  1891. X!      * to it. However, with deleted notes we need to find
  1892. X!      * the matching slotno (if it exists) to make sure that
  1893. X!      * the deleted and non-deleted notes end up in the same
  1894. X!      * slot number (so they won't be displayed).
  1895. X!      */
  1896. X!     if (appt->flags & DELETED) {
  1897. X!         /* look for matching non-deleted note */
  1898. X!         for (slotno=n_tslots; slotno<N_SLOTS && !found; slotno++) {
  1899. X!             if (slots[slotno].active == INACTIVE)
  1900. X!                 break;    /* no more notes */
  1901. X!             for (optr=slots[slotno].first;optr;optr=optr->next) {
  1902. X!                 if (!strcmp(appt->str, optr->str) && !(optr->flags & DELETED)) {
  1903. X!                     found = 1;
  1904. X!                     break;
  1905. X!                 }
  1906. X!             }
  1907. X!         }
  1908. X!     } else {
  1909. X!         /* look for matching deleted note */
  1910. X!         for (slotno=n_tslots; slotno<N_SLOTS && !found; slotno++) {
  1911. X!             if (slots[slotno].active == INACTIVE)
  1912. X!                 break;    /* no more notes */
  1913. X!             for (optr=slots[slotno].first;optr;optr=optr->next)
  1914. X!                 if (!strcmp(appt->str, optr->str) && (optr->flags & DELETED)) {
  1915. X!                     found = 1;
  1916. X!                     break;
  1917. X!                 }
  1918. X!         }
  1919. X!     }
  1920. X!     if (found)
  1921. X!         --slotno;  /* for loop incremented slotno */
  1922. X      if (slotno == N_SLOTS) {
  1923. X          /* overflow of notes field, so
  1924. X           * add to last note field list
  1925. X***************
  1926. X*** 424,429
  1927. X      add_to_slot(slotno, appt, FALSE);
  1928. X  }
  1929. X  
  1930. X  /* draw in todays appointments */
  1931. X  draw_day_appts()
  1932. X  {
  1933. X
  1934. X--- 488,494 -----
  1935. X      add_to_slot(slotno, appt, FALSE);
  1936. X  }
  1937. X  
  1938. X+ #ifndef NOTOOL
  1939. X  /* draw in todays appointments */
  1940. X  draw_day_appts()
  1941. X  {
  1942. X***************
  1943. X*** 555,560
  1944. X          }
  1945. X      }
  1946. X  }
  1947. X  
  1948. X  /*
  1949. X   * Add an appointment entry pointed to by aptr to the day slot
  1950. X
  1951. X--- 620,626 -----
  1952. X          }
  1953. X      }
  1954. X  }
  1955. X+ #endif  /* NOTOOL */
  1956. X  
  1957. X  /*
  1958. X   * Add an appointment entry pointed to by aptr to the day slot
  1959. X***************
  1960. X*** 600,606
  1961. X      n_arrows = nappt->arrows;
  1962. X      if (nappt->flags & DELETED) {
  1963. X          /* look for matching non-deleted appt in list */
  1964. X!         for (optr=slots[slotno].first;optr;optr=optr->next)
  1965. X              if (!strcmp(nappt->str, optr->str) && !(optr->flags & DELETED)) {
  1966. X                  found = 1;
  1967. X                  break;
  1968. X
  1969. X--- 666,672 -----
  1970. X      n_arrows = nappt->arrows;
  1971. X      if (nappt->flags & DELETED) {
  1972. X          /* look for matching non-deleted appt in list */
  1973. X!         for (optr=slots[slotno].first;optr && !found;optr=optr->next)
  1974. X              if (!strcmp(nappt->str, optr->str) && !(optr->flags & DELETED)) {
  1975. X                  found = 1;
  1976. X                  break;
  1977. X***************
  1978. X*** 645,651
  1979. X          }
  1980. X      } else {
  1981. X          /* look for matching deleted appt in list */
  1982. X!         for (optr=slots[slotno].first;optr;optr=optr->next)
  1983. X              if (!strcmp(nappt->str, optr->str) && optr->flags & DELETED) {
  1984. X                  found = 1;
  1985. X                  break;
  1986. X
  1987. X--- 711,717 -----
  1988. X          }
  1989. X      } else {
  1990. X          /* look for matching deleted appt in list */
  1991. X!         for (optr=slots[slotno].first;optr && !found;optr=optr->next)
  1992. X              if (!strcmp(nappt->str, optr->str) && optr->flags & DELETED) {
  1993. X                  found = 1;
  1994. X                  break;
  1995. X*** /tmp/,RCSt1a16937    Fri Dec 15 17:22:58 1989
  1996. X--- event.c    Fri Dec 15 17:17:33 1989
  1997. X***************
  1998. X*** 1,5
  1999. X  /*
  2000. X!  * $Header: event.c,v 2.1 89/05/09 14:23:23 billr Exp $
  2001. X   */
  2002. X  /*
  2003. X   * event.c
  2004. X
  2005. X--- 1,5 -----
  2006. X  /*
  2007. X!  * $Header: event.c,v 2.2 89/12/15 17:17:30 billr Exp $
  2008. X   */
  2009. X  /*
  2010. X   * event.c
  2011. X***************
  2012. X*** 40,46
  2013. X  extern Frame fframe, sframe, mframe;
  2014. X  extern struct tm olddate;
  2015. X  extern int update_interval, show_time;
  2016. X! extern char timestr[], todays_date[];
  2017. X  extern Icon icon;
  2018. X  Notify_value myframe_interposer();
  2019. X  
  2020. X
  2021. X--- 40,46 -----
  2022. X  extern Frame fframe, sframe, mframe;
  2023. X  extern struct tm olddate;
  2024. X  extern int update_interval, show_time;
  2025. X! extern char timestr[];
  2026. X  extern Icon icon;
  2027. X  extern int monday_first, hour24;
  2028. X  extern Pixfont *sfont;
  2029. X***************
  2030. X*** 42,47
  2031. X  extern int update_interval, show_time;
  2032. X  extern char timestr[], todays_date[];
  2033. X  extern Icon icon;
  2034. X  Notify_value myframe_interposer();
  2035. X  
  2036. X  void
  2037. X
  2038. X--- 42,49 -----
  2039. X  extern int update_interval, show_time;
  2040. X  extern char timestr[];
  2041. X  extern Icon icon;
  2042. X+ extern int monday_first, hour24;
  2043. X+ extern Pixfont *sfont;
  2044. X  Notify_value myframe_interposer();
  2045. X  
  2046. X  void
  2047. X***************
  2048. X*** 120,125
  2049. X                      (y <= week_arrows[i].bottom))  {
  2050. X              week_index = i;
  2051. X              current.tm_mday = -current.tm_wday + 1 + (7 * week_index);
  2052. X                          selected_type = WEEK;
  2053. X                          pw_write(main_pixwin,week_arrows[week_index].left,
  2054. X                            week_arrows[week_index].top,smallarrow_pr->pr_size.x,
  2055. X
  2056. X--- 122,129 -----
  2057. X                      (y <= week_arrows[i].bottom))  {
  2058. X              week_index = i;
  2059. X              current.tm_mday = -current.tm_wday + 1 + (7 * week_index);
  2060. X+             if (monday_first)
  2061. X+                 current.tm_mday++;
  2062. X                          selected_type = WEEK;
  2063. X                          pw_write(main_pixwin,week_arrows[week_index].left,
  2064. X                            week_arrows[week_index].top,smallarrow_pr->pr_size.x,
  2065. X***************
  2066. X*** 211,217
  2067. X          sframe_done(0);
  2068. X  #endif
  2069. X      check_calendar();    /* update icon */
  2070. X!     if (show_time) {
  2071. X          /* update time label */
  2072. X          strcpy(timestr, todays_date+10);
  2073. X          if (update_interval == 60)
  2074. X
  2075. X--- 215,221 -----
  2076. X          sframe_done(0);
  2077. X  #endif
  2078. X      check_calendar();    /* update icon */
  2079. X!     if (show_time)
  2080. X          /* update time label */
  2081. X          update_icon_time();
  2082. X  }
  2083. X***************
  2084. X*** 213,227
  2085. X      check_calendar();    /* update icon */
  2086. X      if (show_time) {
  2087. X          /* update time label */
  2088. X!         strcpy(timestr, todays_date+10);
  2089. X!         if (update_interval == 60)
  2090. X!             /* display hh:mm */
  2091. X!             timestr[6] = '\0';
  2092. X!         else
  2093. X!             /* display hh:mm:ss */
  2094. X!             timestr[9] = '\0';
  2095. X!         cur_icon = (Icon) window_get(frame, FRAME_ICON);
  2096. X!         icon_set(cur_icon, ICON_LABEL, timestr, 0);
  2097. X!         window_set(frame, FRAME_ICON, cur_icon, 0);
  2098. X      }
  2099. X  }
  2100. X
  2101. X--- 217,256 -----
  2102. X      check_calendar();    /* update icon */
  2103. X      if (show_time)
  2104. X          /* update time label */
  2105. X!         update_icon_time();
  2106. X! }
  2107. X! 
  2108. X! /* update the time field of the current icon */
  2109. X! update_icon_time()
  2110. X! {
  2111. X!     Icon cur_icon;
  2112. X! 
  2113. X!     format_icon_time();
  2114. X!     cur_icon = (Icon) window_get(frame, FRAME_ICON);
  2115. X!     icon_set(cur_icon, ICON_LABEL, timestr, 0);
  2116. X!     window_set(frame, FRAME_ICON, cur_icon, 0);
  2117. X! }
  2118. X! 
  2119. X! format_icon_time()
  2120. X! {
  2121. X!     if (update_interval >= 60)
  2122. X!         /* display hh:mm */
  2123. X!         sprintf(timestr, " %2d:%02d", today.tm_hour, today.tm_min);
  2124. X!     else
  2125. X!         /* display hh:mm:ss */
  2126. X!         sprintf(timestr, " %2d:%02d:%02d", today.tm_hour, today.tm_min, today.tm_sec);
  2127. X!     if (!hour24) {
  2128. X!         /* display am/pm for 12-hour time */
  2129. X!         if (today.tm_hour > 12) {
  2130. X!             strcat(timestr, "pm");
  2131. X!             timestr[1] = ((today.tm_hour - 12) / 10) + '0';
  2132. X!             timestr[2] = ((today.tm_hour - 12) % 10) + '0';
  2133. X!         } else if (today.tm_hour == 12) {
  2134. X!             strcat(timestr, "pm");
  2135. X!         } else {
  2136. X!             strcat(timestr, "am");
  2137. X!         }
  2138. X!         if (timestr[1] == '0')
  2139. X!             timestr[1] = ' ';
  2140. X      }
  2141. X  }
  2142. X*** /tmp/,RCSt1a24048    Mon Dec 18 17:14:37 1989
  2143. X--- dates/space    Mon Dec 18 17:13:53 1989
  2144. X***************
  2145. X*** 1,5
  2146. X  # CalenTool V2 - DO NOT REMOVE THIS LINE
  2147. X! # $Header: space,v 1.2 89/08/25 11:18:46 billr Exp $
  2148. X  # Special days file for calentool (rel 2.1)
  2149. X  # Submitted by Steve Gilbreath <steve@prism.gatech.edu>
  2150. X  # Space events of note
  2151. X
  2152. X--- 1,5 -----
  2153. X  # CalenTool V2 - DO NOT REMOVE THIS LINE
  2154. X! # $Header: space,v 2.1 89/12/18 17:13:32 billr Exp $
  2155. X  # Special days file for calentool (rel 2.1)
  2156. X  # Submitted by Steve Gilbreath <steve@prism.gatech.edu>
  2157. X  # Space events of note
  2158. X***************
  2159. X*** 111,117
  2160. X  ** 04 20 99 99 00 Soyuz T-8 launched; mission aborted when capsule failed to dock with Salyut station. (1983)
  2161. X  ** 04 23 99 99 00 Advisory council for Aeronautics became National Advisory Council on Aeronautics (NACA). (1915)
  2162. X  ** 04 23 99 99 00 Launch of 1st Soviet communications satelite. (1965)
  2163. X! ** 04 23 99 99 00 USSR Soyus 1 launched with Vladimir Komarov becoming the 1st cosomonaut to make 2 flights. He also became 1st man to die in space after his parachute line tangled on re-entry.  Soyus 1.  All Soviet manned flights ceased for 18 months.
  2164.  (1967)
  2165. X  ** 04 24 99 99 00 China becomes 5th nation to launch artificial satellite. (1970)
  2166. X  ** 04 25 99 99 00 Mercury/Atlas rocket lifted off with an electronic mannequin; when inertial guidance system failed 40 seconds after launch the rocket was destroyed by range safety officer. (1961)
  2167. X  ** 04 26 99 99 00 US/UK launched Ariel; 1st International payload. (1962)
  2168. X
  2169. X--- 111,117 -----
  2170. X  ** 04 20 99 99 00 Soyuz T-8 launched; mission aborted when capsule failed to dock with Salyut station. (1983)
  2171. X  ** 04 23 99 99 00 Advisory council for Aeronautics became National Advisory Council on Aeronautics (NACA). (1915)
  2172. X  ** 04 23 99 99 00 Launch of 1st Soviet communications satelite. (1965)
  2173. X! ** 04 23 99 99 00 USSR Soyus 1 launched with Vladimir Komarov becoming the 1st cosomonaut to make 2 flights. Also became 1st man to die in space after his parachute line tangled on re-entry. All Soviet manned flights ceased for 18 months. (1967)
  2174. X  ** 04 24 99 99 00 China becomes 5th nation to launch artificial satellite. (1970)
  2175. X  ** 04 25 99 99 00 Mercury/Atlas rocket lifted off with an electronic mannequin; when inertial guidance system failed 40 seconds after launch the rocket was destroyed by range safety officer. (1961)
  2176. X  ** 04 26 99 99 00 US/UK launched Ariel; 1st International payload. (1962)
  2177. X*** /tmp/,RCSt1a24057    Mon Dec 18 17:15:10 1989
  2178. X--- dates/world    Mon Dec 18 17:14:16 1989
  2179. X***************
  2180. X*** 1,5
  2181. X  # CalenTool V2 - DO NOT REMOVE THIS LINE
  2182. X! # $Header: world,v 2.2 89/05/16 10:46:16 billr Exp $
  2183. X  # Special days file for calentool (rel 2.1); modified from network posting by
  2184. X  # RPC Rodgers, UCSF, Nov. 1988
  2185. X  # Various holidays commemorated around the world (non-US and Canadian)
  2186. X
  2187. X--- 1,5 -----
  2188. X  # CalenTool V2 - DO NOT REMOVE THIS LINE
  2189. X! # $Header: world,v 2.3 89/12/18 17:14:00 billr Exp $
  2190. X  # Special days file for calentool (rel 2.1); modified from network posting by
  2191. X  # RPC Rodgers, UCSF, Nov. 1988
  2192. X  # Various holidays commemorated around the world (non-US and Canadian)
  2193. X***************
  2194. X*** 41,47
  2195. X  ** 01 23 99 99 00 Feast of St. Ildefonsus
  2196. X  ** 01 24 99 99 00 Economic Liberation Day (Togo)
  2197. X  ** 01 26 99 99 00 Republic Day (India)
  2198. X! ** 01 30 99 99 00 Australia Day (Australia)
  2199. X  ** 02 01 99 99 00 Chinese New Year Holiday (3 days) (Taiwan)
  2200. X  ** 02 03 99 99 00 Setsubun, Change of Season or "Bean Throwing Night" (Japan)
  2201. X  ** 02 04 99 99 00 Independence Commemoration Day (Sri Lanka)
  2202. X
  2203. X--- 41,47 -----
  2204. X  ** 01 23 99 99 00 Feast of St. Ildefonsus
  2205. X  ** 01 24 99 99 00 Economic Liberation Day (Togo)
  2206. X  ** 01 26 99 99 00 Republic Day (India)
  2207. X! ** 01 26 99 99 00 Australia Day (Australia)
  2208. X  ** 02 01 99 99 00 Chinese New Year Holiday (3 days) (Taiwan)
  2209. X  ** 02 03 99 99 00 Setsubun, Change of Season or "Bean Throwing Night" (Japan)
  2210. X  ** 02 04 99 99 00 Independence Commemoration Day (Sri Lanka)
  2211. X***************
  2212. X*** 366,372
  2213. X  ** 09 30 99 99 00 Botswanna Day (Botswanna)
  2214. X  ** 10 01 99 99 00 Armed Forces Day (South Korea)
  2215. X  ** 10 01 99 99 00 Independence Day (Nigeria)
  2216. X! ** 10 01 99 99 00 Labor Day (Australia)
  2217. X  ** 10 01 99 99 00 National Liberation Day (2 days) (China)
  2218. X  ** 10 01 99 99 00 Public Holiday (Botswanna)
  2219. X  ** 10 02 99 99 00 Anniversary of Guinean Independence (Guinea)
  2220. X
  2221. X--- 366,372 -----
  2222. X  ** 09 30 99 99 00 Botswanna Day (Botswanna)
  2223. X  ** 10 01 99 99 00 Armed Forces Day (South Korea)
  2224. X  ** 10 01 99 99 00 Independence Day (Nigeria)
  2225. X! #** 10 01 99 99 00 Labor Day (Australia) [really 1st Monday in October]
  2226. X  ** 10 01 99 99 00 National Liberation Day (2 days) (China)
  2227. X  ** 10 01 99 99 00 Public Holiday (Botswanna)
  2228. X  ** 10 02 99 99 00 Anniversary of Guinean Independence (Guinea)
  2229. END_OF_FILE
  2230. if test 46931 -ne `wc -c <'patches05b'`; then
  2231.     echo shar: \"'patches05b'\" unpacked with wrong size!
  2232. fi
  2233. # end of 'patches05b'
  2234. fi
  2235. echo shar: End of archive 2 \(of 4\).
  2236. cp /dev/null ark2isdone
  2237. MISSING=""
  2238. for I in 1 2 3 4 ; do
  2239.     if test ! -f ark${I}isdone ; then
  2240.     MISSING="${MISSING} ${I}"
  2241.     fi
  2242. done
  2243. if test "${MISSING}" = "" ; then
  2244.     echo You have unpacked all 4 archives.
  2245.     rm -f ark[1-9]isdone
  2246. else
  2247.     echo You still need to unpack the following archives:
  2248.     echo "        " ${MISSING}
  2249. fi
  2250. ##  End of shell archive.
  2251. exit 0
  2252.  
  2253.